﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using RED_NET_Core.DAL;
using System.Configuration;
using System.Collections;

namespace RED_NET_Core.BLL
{
    public class Class_BLL
    {
        //构造函数
        public Class_BLL() { }

        #region[将Excel表导成DataSet]
        public DataSet GetDataSetByExcel(string fileNamePath, string table)
        {
            Class_DAL classDAL = new Class_DAL();
            return classDAL.TransformFromExcelToDataSet(fileNamePath, table);
        }

        #endregion


        #region[利用dataset批量导入用户]

        public int BatchInsetIntoUser(DataSet ds,int tBeOfUserId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.InsetIntoUser(ds, tBeOfUserId);
            }
            catch (Exception ex)
            {
                throw ex;//如果DAL有异常被抛出，这里将会收到到异常信息，但还是不处理，继续抛出
            }
        }

        #endregion

        #region[ ]

        public void BatchInsetIntoUsers1(string _Uid, string _Name, string _Sex, String _Colleage, String _Major, string _Class, String _Position, string _PoliticsStatus,string _LongTel,string _ShortTel,string _BeOfUserId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                //string _Competition,string _Achievements,string _VolunteerTime,string _ReceivedHonors,
               classDAL.Insert(_Uid,_Name,_Sex,_Colleage,_Major,_Class,_Position,_PoliticsStatus,_LongTel,_ShortTel,_BeOfUserId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion

        #region[新建基本信息]
        public bool InsertInfo(string _Uid, string _Name, string _Sex,string _College,string _Major,string _Class, String _Position, string _PoliticsStatus, string _LongTel, string _ShortTel,  string _BeOfUserId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                classDAL.Insert(_Uid, _Name, _Sex,_College,_Major ,_Class , _Position, _PoliticsStatus, _LongTel, _ShortTel, _BeOfUserId);
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[更新基本信息]
        public bool  UpdateInfo(string _Id,string _PoliticsStatus, string _LongTel, string _ShortTel)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.Update(_Id,_PoliticsStatus, _LongTel, _ShortTel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[查找基本信息]
        public DataTable SelectInfo(int _Id)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.Select(_Id);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[删除基本信息]
        public bool DeleteInfo(int _Id)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.Delete(_Id);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion



        #region[新建学术科研成果]
        public bool InsertInfoResearch(string _Content, string _BeOfStdId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                classDAL.InsertResearch(_Content, _BeOfStdId);
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[更新学术科研成果]
        public bool UpdateInfoResearch(string _ResearchId, string _Content)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.UpdateResearch(_ResearchId, _Content);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[查找学术科研成果]
        public DataTable SelectInfoResearch(int _ResearchId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.SelectResearch(_ResearchId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[删除学术科研成果]
        public bool DeleteInfoResearch(int _ResearchId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.DeleteResearch(_ResearchId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion



        #region[新建志愿者活动]
        public bool InsertInfoVt(string _Content,string _AddTime, string _BeOfStdId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                classDAL.InsertVt(_Content, _AddTime, _BeOfStdId);
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[更新志愿者活动]
        public bool UpdateInfoVt(string _VolunteerId, string _Content,string _AddTime)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.UpdateVt(_VolunteerId, _Content,_AddTime );
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[查找志愿者活动]
        public DataTable SelectInfoVt(int _VolunteerId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.SelectVt(_VolunteerId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[删除志愿者活动]
        public bool DeleteInfoVt(int _VolunteerId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.DeleteVt(_VolunteerId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion




        #region[新建竞赛活动]
        public bool InsertInfoContest( string _Content, string _BeOfStdId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                classDAL.InsertContest(_Content, _BeOfStdId);
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[更新竞赛活动]
        public bool UpdateInfoContest(string _ContestId, string _Content)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.UpdateContest(_ContestId, _Content);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[查找竞赛活动]
        public DataTable SelectInfoContest(int _ContestId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.SelectContest(_ContestId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[删除竞赛活动]
        public bool DeleteInfoContest(int _ContestId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.DeleteContest(_ContestId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion



        #region[新建所获荣誉]
        public bool InsertInfoHonour(string _Content, string _BeOfStdId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                classDAL.InsertHonour(_Content, _BeOfStdId);
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[更新所获荣誉]
        public bool UpdateInfoHonour(string _HonourId, string _Content)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.UpdateHonour(_HonourId, _Content);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[查找所获荣誉]
        public DataTable SelectInfoHonour(int _HonourId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.SelectHonour(_HonourId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region[删除所获荣誉]
        public bool DeleteInfoHonour(int _HonourId)
        {
            Class_DAL classDAL = new Class_DAL();
            try
            {
                return classDAL.DeleteHonour(_HonourId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion

        //学生信息
        #region[查找单条学生信息]

        public DataTable GetStuInfo(int iStu)
        {
            Class_DAL nClassDal = new Class_DAL();
            try
            {
                return nClassDal.GetStuInfo(iStu);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion


    }
}
